﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EquipmentForm.aspx.cs"
    Inherits="FX.CC.Andon.WebSite.CommForm.EquipmentForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../lib/boot.js" type="text/javascript"></script>
</head>
<body>
    <div class="mini-toolbar" style="padding: 2px;" borderstyle="border:0;">
        <table style="width: 100%;">
            <tr>
                <td style="width: 100%;">
                    设备编号：<input id="EqCode" class="mini-textbox" emptytext="请输入设备编号" style="width: 150px;"
                        onenter="onKeyEnter" />
                    设备名称：<input id="EqName" class="mini-textbox" emptytext="请输入设备名称" style="width: 150px;"
                        onenter="onKeyEnter" />
                    <a class="mini-button" iconcls="icon-search" onclick="search()">查 询</a> <a class="mini-button"
                        iconcls="icon-reset" onclick="reset()">重 置</a>
                </td>
            </tr>
        </table>
    </div>
    <!--撑满页面-->
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;" idfield="EqID"
            showfooter="false" onrowdblclick="ondoubleclick()" borderstyle="border-left:0;border-right:0;"
            multiselect="true">
            <div property="columns">
                <div type="indexcolumn" width="10px">
                </div>
                <div type="checkcolumn" width="15px">
                </div>
                <div field="EqCode" width="120" headeralign="center" allowsort="true">
                    设备编号
                </div>
                <div field="EqName" width="120" headeralign="center" allowsort="false">
                    设备名称
                </div>
            </div>
        </div>
    </div>
    <div class="mini-toolbar" style="text-align: center; padding-top: 8px; padding-bottom: 8px;"
        borderstyle="border:0;">
        <a class="mini-button" iconcls="icon-ok" style="width: 60px;" onclick="onOk()">确定</a>
        <span style="display: inline-block; width: 25px;"></span><a class="mini-button" iconcls="icon-cancel"
            style="width: 60px;" onclick="onCancel()">取消</a>
    </div>
    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        var WSID;
        function search() {
            var EqCode = mini.get("EqCode").getValue();
            var EqName = mini.get("EqName").getValue();
            grid.load({ WSID: WSID, EqCode: EqCode, EqName: EqName });
        }
        //回车键事件
        function onKeyEnter() {
            search();
        }

        function GetData() {
            var rows = grid.getSelecteds();
            var data = [];
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                data.push(row);
            }
            return data;
        }
        function ondoubleclick() {
            onOk();
        }
        function SetData(data) {
            if (data.action == "Select") {
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);
                WSID = data.WSID;
                grid.setUrl("../service/BasicDataManageHandler.ashx?action=GetEqByWSID");
                grid.load({ WSID: WSID });
            }
        }
        function onOk() {
            var rows = grid.getSelecteds();
            if (rows) {
                CloseWindow("ok");
            }
            else {
                mini.alert("请选中一条您需要添加的记录!");
            }

        }
        function ondoubleclick() {
            onOk();
        }

        function reset() {
            mini.get("EqCode").setValue("");
            mini.get("EqName").setValue("");
        }
        function CloseWindow(action) {
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }
        function onCancel() {
            CloseWindow("close");
        }
    </script>
</body>
</html>
